package com.hmall.order.web;

import com.hmall.common.FeignClientItem;
import com.hmall.common.FeignClientMy;
import com.hmall.common.pojo.Address;
import com.hmall.common.pojo.Item;
import com.hmall.common.pojo.User;
import com.hmall.order.config.TreadLocalMain;
import com.hmall.order.pojo.Order;
import com.hmall.order.pojo.OrderDto;
import com.hmall.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {


   @Autowired
   private IOrderService orderService;

   @GetMapping("/{id}")
   public Order queryOrderById(@PathVariable("id") Long orderId) {
      return orderService.getById(orderId);
   }

   /**
    * 支付下订单
    * @param orderDto
    * @return
    */
   @PostMapping
   public long saveOrder(@RequestBody OrderDto orderDto){
      long l = orderService.saveOrder(orderDto);
      return l;
   }
}
